import Taro from '@tarojs/taro'

export default {
    // 路由跳转
    goto: (path, data) => {
      Taro.navigateTo({
        url: `../../${path}`,
        success: (res) => res.eventChannel.emit('routerData', {data})
      })
    },
    // 重置路由跳转
    reto: (path,data) => {
      Taro.redirectTo({
        url: `../../${path}`,
        success: (res) =>res.eventChannel.emit('routerData', {data})
      })
    },
    // 返回上一页，或上几页
    backto: num => {
      Taro.navigateBack({delta: num ? num : 1 })
    }
}
